﻿package fui.FUIComponents{
	import flash.events.*;
	import flash.display.Sprite;
	import fl.controls.*;
	import fl.containers.ScrollPane;
	
	import fl.events.ScrollEvent;

	import fui.FUIData.IDBClient;
	import fui.FUIData.DBClientV2;
	import fui.FUIComponents.SearchComponent;
	import fui.FUIComponents.TemplateItem;
	
	public class BoardTemplateView extends Sprite{
		
		private var leftTab:int = 10;
		private var _options:Array;
		private var _dp:Array;
		private var _templList:ScrollPane;
		
				
		public function BoardTemplateView(dataprv:Array)
		{
			_dp = dataprv;
			_options = new Array();
			
			createView();
		}
		private function createView():void
		{
			_templList = new ScrollPane();
			_templList.setSize(310,180);
			_templList.scrollDrag = true;
			_templList.addEventListener(ScrollEvent.SCROLL, scrollHandler);
		
			addChild(_templList);
			var tt:Array = new Array();
			tt.push("board size:");
			tt.push("max players:");
			var dd:Array = new Array();
			dd.push("48");
			dd.push("4");
			var dt:Object = new Object();
			
			dt.titles = tt;
			dt.datas = dd;
			dt.imagepath = "imgs/monopolysm.png";
			_dp[0] = new TemplateItem(dt, 85, 300, 1);
			var dt1:Object = new Object();
			var dd1:Array = new Array();
			dd1.push("64");
			dd1.push("6");
			dt1.datas = dd1;
			dt1.titles = tt;
			dt1.imagepath = "imgs/monopolysm1.png";
			_dp[1] = new TemplateItem(dt1, 85, 300, 91);
			//_dp[2] = new TemplateItem(dt1, 85, 300, 221);
			_dp[0].addEventListener(MouseEvent.CLICK, responseClick);
			_dp[1].addEventListener(MouseEvent.CLICK, responseClick);
			_templList.addChild(_dp[0]);
			_templList.addChild(_dp[1]);
			//_templList.addChild(_dp[2]);
			
			
		}
		
		function responseClick(event:Event):void
		{
			trace(event.target.name);
		}
		function scrollHandler(event:ScrollEvent):void {
    		var mySP:ScrollPane = event.currentTarget as ScrollPane;
    		trace("scrolling");
    		trace("\t" + "direction:", event.direction);
    		trace("\t" + "position:", event.position);
    		trace("\t" + "horizontalScrollPosition:", mySP.horizontalScrollPosition, "of", mySP.maxHorizontalScrollPosition);
    		trace("\t" + "verticalScrollPosition:", mySP.verticalScrollPosition, "of", mySP.maxVerticalScrollPosition);
}

		
		
	}
	
}